Skip to content

Conversation

@domingo2000
Copy link
Contributor

@domingo2000 domingo2000 commented Jul 27, 2025

First implementation for I18n support (#639)

How it works

  1. Attach file watcher for all translation files
  2. Add server request to reload translations on file changes. The reload is fast because does not need to reload the entire rails server, just the I18n.
  3. Add server request to get I18n translations for all locales available in the I18n backend.
  4. On hover of I18n.t("hello") key string argument, request the server all the translations available and provide hover info for that.

It address points 1 and 2 of the issue list:

  1. Read what the translation says. e.g., I18n.t("hello") returns en: "Hello World", es: "¡Hola Mundo!".
  2. Find out if a translation is missing.

And is usefull for updating and creating translations because it gives feedback that the used translations "is correct" because makes direct calls to the I18n backend while typing and hovering it. Warning if the translation is missing.

This gives the following experience:
Screencast from 2025-07-27 00-40-33.webm

@domingo2000 domingo2000 requested a review from a team as a code owner July 27, 2025 04:44
@cb341
Copy link

cb341 commented Dec 15, 2025

Whoa this is most wonderful!
Any plans on getting this merged?

@Drowze
Copy link

Drowze commented Jan 14, 2026

This is a fantastic addition to ruby-lsp-rails - hope it gets reviewed & merged soon 🤞

As of now, there's even a 3rd party addon built due to the lack of i18n support: https://github.com/bukhr/ruby-lsp-i18n

@andy-rootly
Copy link

Gave it a quick try with Zed and Cursor on app with a high number of translations. Seems to work nicely.

@andy-rootly
Copy link

It would also be nice if Go To Definition jumped to the entry in the locale file.

Copy link
Member

@rafaelfranca rafaelfranca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small thinks

return unless receiver.name == :I18n

message = call_node.message
return unless message == "t"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also handle the translate method.

@rafaelfranca rafaelfranca force-pushed the feat/add-hover-on-i18n-translations branch from 597cd33 to 228a9a1 Compare January 20, 2026 23:23
@rafaelfranca rafaelfranca added the enhancement New feature or request label Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants